In a virtualized environment, a host machine normally runs one or more virtual machines thereon, and the host machine normally is required to know an internal running state of a virtual machine. The host machine, when running many virtual machines thereon, normally cannot view the internal running state of each virtual machine all the time. When a virtual machine encounters an internal exception (for example, the virtual machine crashes or goes into a blue screen) and cannot be detected by the host machine, the host machine does not perform processing on the virtual machine for a long period of time, resulting in that a service in the virtual machine is interrupted for a long period of time, which wastes resources such as memory of the host machine. Therefore, it is very necessary for the host machine to know whether an internal exception occurs on the virtual machine.
At present, a virtual machine normally is capable of periodically sending heartbeat information of the virtual machine to the host machine by using software. For example, a virtual machine sends heartbeat information of the virtual machine to a host machine every second by using VMware Tools in virtual machine software VMware, and a virtual machine monitoring module in the host machine detects, at intervals, whether heartbeat information is sent to the host machine within the period (for example, the virtual machine monitoring module detects, every 20 seconds, whether heartbeat information is sent to the host machine within the 20 seconds). If the virtual machine monitoring module detects no heartbeat information within a period of time, the virtual machine monitoring module determines that an internal running fault occurs on the virtual machine. In such cases, the virtual machine monitoring module may control the virtual machine to reset. A specific interaction process thereof is shown in FIG. 1.
During the implementation of embodiments of the present invention, the inventor finds that the prior art has at least the following problem.
The method of determining, by using heartbeat information, whether an internal running fault occurs on a virtual machine is not accurate, and the virtual machine monitoring module cannot detect, in a timely manner, the internal running fault that occurs on the virtual machine. In addition, the virtual machine is restored by resetting the virtual machine, and when the virtual machine runs again, a fault may still be caused by the same reason that causes the previous fault.